//
//  RealmManager.h
//  flutter
//
//  Created by GilesZhou on 2020/6/29.
//  Copyright © 2020 Ganee. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Realm.h>

NS_ASSUME_NONNULL_BEGIN

/// 保存类型
typedef NS_ENUM(NSUInteger, RealmSaveType) {
    /// 崩溃信息
    RealmSaveTypeCrash,
};
extern NSString * const RealmSaveTypeFromString(RealmSaveType type);




@interface RealmManager : NSObject
/// 写入缓存中
+ (void)writeData:(RLMObject *)data;
/// 查询缓存中数据
+ (RLMResults *)searchDataWithType:(RealmSaveType)type;
/// 删除缓存中单条记录
+ (void)deleteData:(RLMObject *)data;
/// 删除缓存中多条数据
+ (void)deleteResults:(RLMResults *)results;
///删除缓存中表中所有的数据
+ (void)deleteAllData;

#pragma mark - local
/// 读取本地realm中数据
+ (RLMResults *)readLocalRealmWithType:(RealmSaveType)type;

@end

NS_ASSUME_NONNULL_END
